/**
 * Copyright © 2013 Creativor Studio.
 * About license information, please see LICENSE.txt.
 */
package org.creativor.rayson.share.transport.nio;

import java.io.IOException;

/**
 * Socket connection interface. Use NIO technology.
 * 
 * @author creativor
 */
public interface NioConnection {

	/**
	 * Asynchrony read from this connection.
	 * 
	 * @return
	 * @throws IOException
	 */
	public abstract int asyncRead() throws IOException;

	/**
	 * Asynchrony write to this connection.
	 * 
	 * @throws IOException
	 */
	public abstract void asyncWrite() throws IOException;

	/**
	 * Close this connection. This will close the underling socket.
	 * 
	 * @throws IOException
	 *             Signals that an I/O exception has occurred.
	 */
	public abstract void close() throws IOException;

	/**
	 * @return Read buffer object of this connection.
	 */

	public abstract ReadBuffer getReadBuffer();

	/**
	 * @return Write buffer object of this connection.
	 */
	public abstract WriteBuffer getWriteBuffer();

}